辣鸡题目。直接STL水掉,84ms AC1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using namespace std;
int a[10], N;
int main(int argc, char **argv)
{
ios::sync_with_stdio(false);
cin >> N;
for (register int i = 1; i <= N; ++i) a[i] = i, cout << " " << i;
cout << endl;
while (next_permutation(a + 1, a + N + 1))
{
for (register int i = 1; i <= N; ++i)
cout << " " << a[i];
cout << endl;
}
return 0;
}
『洛谷 P1706』全排列
-------------本文结束了哦感谢您的阅读-------------
- 本文链接: https://skyofwar.xyz/2018/03/31/『洛谷 P1706』全排列/
- 版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处!